<include file="Public/min-header"/>
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
  <include file="Public/breadcrumb"/>
  <style type="text/css">
  	.table input{display: none;}
  </style>
  <section class="content">
    <div class="container-fluid">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title"><i class="fa fa-list"></i>商户对账</h3>
        </div>
        <div class="panel-body">    
		<div class="navbar navbar-default">                    
                <form id="search-form2" class="navbar-form form-inline"  method="get" action="{:U('store_duizhang')}">
                <div class="form-group">
				  
                  <label for="input-order-id" class="control-label">店铺名:</label>
                  <div class="input-group">
                    <input type="text" class="form-control" id="store_name" placeholder="店铺名" value="{$Think.request.store_name}" name="store_name" />
                  </div>
				  
                  <label for="input-order-id" class="control-label">所属会员:</label>                
                  <div class="input-group">
                    <input type="text" class="form-control" id="user_name" placeholder="所属会员账号" value="{$Think.request.user_name}" name="user_name" />                    
                  </div>
                  
                   <div class="input-group margin">                    
                    <div class="input-group-addon">
                        开店时间<i class="fa fa-calendar"></i>
                    </div>
                       <input type="text" id="start_time" value="{$Think.request.store_time}" name="store_time" class="form-control pull-right">
                  </div>                  
                </div>
                <div class="form-group">    
                    <button class="btn btn-primary" id="button-filter search-order" type="submit"><i class="fa fa-search"></i> 筛选</button>    
                </div>                                 
                </form>    
          </div>
                        
          <div id="ajax_return"> 
                 
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover">
                            <thead>
                            <tr>
                                <th class="sorting text-center">店铺id</th>
                                <th class="sorting text-center">店铺名称</th>
								<th class="sorting text-center">所属会员</th>
                                <th class="sorting text-center">店铺可用资金</th>
                                <th class="sorting text-center">待结算资金</th>
                                <th class="sorting text-center">注册时间</th>                       
                                <th class="sorting text-center">状态</th>                           
                                <th class="sorting text-center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="list" id="v">
                                <tr>
                                    <td class="text-center">
                                            {$v.store_id}
                                    </td>
                                    <td class="text-center">
                                        <a href="{:U('Store/store_info_edit',array('store_id'=>$v[store_id]))}">
                                             {$v.store_name}
                                        </a>
                                    </td>                                    
                                    <td class="text-center">{$v.nickname}</td>
                                    <td class="text-center" style="color: red;"><span>{$v.store_money}</span>
									<input type="text" onchange="updateSort('store','store_id','{$v.store_id}','store_money',this)" size="4" oninput="$(this).parent().find('span').text($(this).val())" value="{$v.store_money}" class="input-sm">
									</td>
                                    <td class="text-center"><span>{$v.pending_money}</span>
									<input type="text" onchange="updateSort('store','store_id','{$v.store_id}','pending_money',this)" size="4" oninput="$(this).parent().find('span').text($(this).val())" value="{$v.store_money}" class="input-sm">
									</td>
                                    <td class="text-center">{$v.store_time|date="Y-m-d",###}</td>                                    
                                    <td class="text-center">                                         
                                        <if condition="$v[store_state] eq 0">关闭</if>                                        
                                        <if condition="$v[store_state] eq 1">开启</if>
                                        <if condition="$v[store_state] eq 2">审核中</if>
                                    </td>                                    
                                    <td class="text-center">
                                        <a href="javascript:" data-toggle="tooltip" rel="{$v.store_id}" class="btn btn-primary" id="pandian" data-original-title="编辑">盘点 <i class="fa fa-pencil"></i></a>
                                    </td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                    </div>
                
                <div class="row">
                    <div class="col-sm-6 text-left"></div>
                    <div class="col-sm-6 text-right">{$show}</div>
                </div>
          
          </div>
        </div>
      </div>
    </div>
    <!-- /.row --> 
  </section>
  <!-- /.content --> 
</div>
<!-- /.content-wrapper --> 
 <script>
 // 删除操作
function del(id)
{
	if(!confirm('确定要删除吗?'))
		return false;		
		$.ajax({
			url:"/index.php?m=Admin&c=Finance&a=delStoreWithdrawals&id="+id,
			success: function(v){	
                            var v =  eval('('+v+')');                                 
                            if(v.hasOwnProperty('status') && (v.status == 1))
                               location.href='{:U('Admin/Finance/store_withdrawals')}';
                            else                                
			        layer.msg(v.msg, {icon: 2,time: 1000}); //alert(v.msg);
			}
		}); 
	 return false;
}
 
$(document).ready(function() {
	$('#start_time').daterangepicker({
		format:"YYYY-MM-DD",
		singleDatePicker: false,
		showDropdowns: true,
		minDate:'2020-01-01',
		maxDate:'2030-01-01',
		startDate:'2020-01-01',
	    locale : {
            applyLabel : '确定',
            cancelLabel : '取消',
            fromLabel : '起始时间',
            toLabel : '结束时间',
            customRangeLabel : '自定义',
            daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
            monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月','七月', '八月', '九月', '十月', '十一月', '十二月' ],
            firstDay : 1
        }
	});
	
	$(".table #pandian").click(function(){
		var myid=$(this).attr('rel');
		var obj=$(this).parent().parent();
		$(".table input").hide();
		$(".table span").show();
		obj.find('input').show();
		obj.find('span').hide();
	});
});
</script>
</body>
</html>